class MyCircularQueue(object):

    def __init__(self, k):
        """
        :type k: int
        """
        self.stack = [0] * k
        self.f_index = -1
        self.l_index = -1
        self.k = k


    def enQueue(self, value):
        """
        :type value: int
        :rtype: bool
        """
        if self.isEmpty():
            self.f_index = 0
            self.l_index = 0
            self.stack[self.f_index] = value
            return True
        if self.isFull():
            return False
        self.l_index = (self.l_index + 1) % self.k
        self.stack[self.l_index] = value
        return True


    def deQueue(self):
        """
        :rtype: bool
        """
        if not self.isEmpty():
            if self.f_index == self.l_index:
                self.f_index = -1
                self.l_index = -1
            else:
                self.f_index = (self.f_index + 1) % self.k

            return True
        else:
            return False


    def Front(self):
        """
        :rtype: int
        """
        if self.isEmpty():
            return -1
        else:
            return self.stack[self.f_index]


    def Rear(self):
        """
        :rtype: int
        """
        if self.isEmpty():
            return -1
        else:
            return self.stack[self.l_index]



    def isEmpty(self):
        """
        :rtype: bool
        """
        if self.f_index == -1:
            return True
        else:
            return False


    def isFull(self):
        """
        :rtype: bool
        """
        return (self.l_index + 1) % self.k == self.f_index